#pragma once 

#include <iostream>
#include <functional>
#include <string>
#include "log.hpp"
//typedef std::function<int (int, int)> func_t;
typedef std::function<int(int, int)> func_tt;
class Task{
public:
    Task(){}
    Task(int x, int y, func_tt func)
        :_x(x),_y(y),func_(func)
        {}
    int operator ()(const std::string &name)
    {
        // std::cout << "线程：" << name << " 处理完成！结果为：" 
        //     << _x << " + " << _y << " = " << _x+_y << std::endl;
        logMessage(WARNING, "%s处理完成: %d+%d=%d | %s | %d",
            name.c_str(), _x, _y, func_(_x, _y), __FILE__, __LINE__);   // 最后两个参数：编译的文件，当前行
        return func_(_x, _y);
    }
    
    int getRet(){
        return _x+_y;
    }

public:
    int _x;
    int _y;
    func_tt func_;
};